<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?php 
	$ci = &get_instance();
	$USER = $ci->user_entity->init('id',$ESCORT->getUserId());
	
	$cityArray = getCityData_ioc($country_id=$ESCORT->getCountryId(), $state_id =$ESCORT->getStateId(), $province_id =$ESCORT->getProvinceId());
	
	$next_element = $current_index = $prev_element = null;
	if(isset($_SESSION['totalRESULTsearch'])){
		$current_key_element = $USER->getUserName();
		$next_key_element = interator_getNext($_SESSION['pagination_result'],$current_key_element);
		$prev_key_element = interator_getPrev($_SESSION['pagination_result'],$current_key_element);
		
		$tmp = ($next_key_element) ? array_values($_SESSION['pagination_result'][$next_key_element]) :array('');
		$next_element = $tmp[0];
		$tmp = array_keys($_SESSION['pagination_result'][$current_key_element]) ;
		$current_index = $tmp[0];
		$tmp = ($prev_key_element) ? array_values($_SESSION['pagination_result'][$prev_key_element]) :array('');
		$prev_element = $tmp[0];
	}
?>

<?php if($pos == 'top'):?>
	<div class="background-images-slideshow-wrapper">
		<div class="carousel js background-images-slideshow">
			<ul>
				<?php $i=0;?>
				<?php foreach($ci->media_entity->getMediaByPermission($ESCORT->getId(),'public_top') as $item):?>
					<?php $MEDIA = $ci->media_entity->init('id', $item->id) ;?>
					<?php if($MEDIA->getType() == 'image'):?>
						<li rel="<?php echo $MEDIA->getId();?>">
							<?php if($MEDIA->getReview() == 1): ?>
								<?php echo thumb($MEDIA->getTargetFileImageTopPublic('big'), PUBLIC_TOP_W, PUBLIC_TOP_H);?>
								
								<?php if($ESCORT->getPublicLanguageIds() == 1):?>
									<div class="introduction-text">
										<a class="ui-dialog-titlebar-close ui-corner-all" href="javascript:void(0);" role="button">
											<span class="ui-icon ui-icon-closethick" style="position:absolute;top:0;right:0;">close</span>
										</a>
										<?php echo $ESCORT->getDescription(get_language_id(),$ESCORT->getUserId());?>
									</div>
								<?php endif; ?>
								
							<?php else: ?>
								
								<?php echo thumb($MEDIA->getTargetFileImageTopPublic('thin'), TOP_THIN_W, TOP_THIN_H);?>
							<?php endif;?>	
						</li>
					<?php else: ?>
						<div>	
							<?php $MEDIA->setClickedNo( $MEDIA->getClickedNo() );$MEDIA->update();?>
							<?php echo playvideo($MEDIA->getTargetFile('video'),$MEDIA->getTargetFile('avatar'),PUBLIC_TOP_W, PUBLIC_TOP_H);?>
						</div>
					<?php endif;?>
					<?php $i++; ?>
				<?php endforeach; ?>	
			</ul>
		</div>
		<?php if($i>1):?>
			<script type="text/javascript">
				$(document).ready(function(){
					$("div.background-images-slideshow").carousel({
						dispItems:1,
						pagination:true,
						autoSlide:false,
						nextBtn: null,
						prevBtn: null
					});
				});
			</script>
		<?php endif;?>
		
		<div class="escort-sheet-info-top-navigation">
			<div class="escort-sheet-info-phone">
				<a href="javascript:void(0);"><img src="{{url:base}}media/img/phone.png" /></a>
			</div>
			<div class="escort-navigation-wrapper">
				<div class="escort-name">
					<span class="name"><?php echo strtoupper($ESCORT->getEscortName());?></span>
					<span class="address"><?php echo language_translate('myzone_page_escort_in').' '.$cityArray[$ESCORT->getCityId()];?></span>
				</div>
				<div class="escort-navigation">
					<?php if( $prev_element != '' ):?>
						<a href="<?php echo "{{url:base}}home/profile/".$prev_element;?>"><img src="{{url:base}}media/img/pre-buton.png" /></a>
					<?php endif;?>	
					
					<?php if( $next_element != '' ):?>
						<a href="<?php echo "{{url:base}}home/profile/".$next_element;?>"><img src="{{url:base}}media/img/next-button.png" /></a>
					<?php endif;?>	 
				</div>
				<div class="clear"></div>
				<div class="order-number">
					<?php if( $current_index != '' ):?>
						<span><?php echo $current_index;?> <?php echo language_translate('myzone_page_escort_of');?> <?php echo $_SESSION['totalRESULTsearch'];?></span>
					<?php endif;?>
				</div>
			</div>
			<div class="clear"></div>
		</div>
		
		
		<div id="open-introduction-text" title="<?php echo language_translate('myzone_page_open_introduction_text'); ?>">123</div>
	</div>
<?php endif; ?>

<?php if($pos == 'bottom'):?>
	<div class="carousel js image-slideshow">
		<ul>
			<?php $i=0;?>
			<?php foreach($ci->media_entity->getMediaByPermission($ESCORT->getId(), 'public') as $item):?>
				<?php $MEDIA = $ci->media_entity->init('id',$item->id);?>
					<?php if($MEDIA->getType() == 'image'):?>
						<li rel="<?php echo $MEDIA->getId();?>">	
							<?php echo thumb($MEDIA->getTargetFileImagePublic(),PUBLIC_W,PUBLIC_H);?>
						</li>
					<?php else:?>
						<li rel="<?php echo $MEDIA->getId();?>">	
							<?php echo playvideo($MEDIA->getTargetFile('video'),$MEDIA->getTargetFile('avatar'),PUBLIC_W,PUBLIC_H);?>
						</li>
					<?php endif;?>
				<?php $i++; ?>	
			<?php endforeach;?>
		</ul>
	</div>
	<?php if($i>1):?>
		<script type="text/javascript">
			$(document).ready(function(){
				$("div.image-slideshow").carousel({
					dispItems:1,
					pagination:true,
					autoSlide:false,
					nextBtn: null,
					prevBtn: null		
				});
			});
		</script>
	<?php endif;?>
<?php endif; ?>

